import { EntitySchema } from '@mikro-orm/core';

export class LeOrderBuyer {
  id!: string;
  orderSn!: string;
  note!: string;
  name!: string;
  mobile!: string;
  province!: string;
  city!: string;
  district!: string;
  address!: string;
  createdTime!: string;
  updatedTime?: string;
  deletedTime?: string;
  isDeleted: boolean = false;
}

export const LeOrderBuyerSchema = new EntitySchema({
  class: LeOrderBuyer,
  properties: {
    id: { primary: true, type: 'string', columnType: 'bigint' },
    orderSn: { type: 'string', length: 50, index: '订单编号' },
    note: { type: 'string', length: 255 },
    name: { type: 'string', length: 50 },
    mobile: { type: 'string', length: 50 },
    province: { type: 'string', length: 50 },
    city: { type: 'string', length: 50 },
    district: { type: 'string', length: 50 },
    address: { type: 'string', length: 255 },
    createdTime: { type: 'string', columnType: 'bigint' },
    updatedTime: { type: 'string', columnType: 'bigint', nullable: true },
    deletedTime: { type: 'string', columnType: 'bigint', nullable: true },
    isDeleted: { type: 'boolean', default: false },
  },
});
